const express = require('express');
const app = express();

// 中间件
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

// 挂载微信服务
app.use('/api/wechat', require('./services/wechat-service')); // 根据您实际的文件名调整

// 挂载DeepSeek服务 - 使用新的扁平化路由文件
app.use('/api/deepseek', require('./services/deepseek-routes'));

// 全局健康检查
app.get('/health', (req, res) => {
  res.json({ 
    status: 'ok', 
    services: ['wechat', 'deepseek'],
    timestamp: new Date().toISOString()
  });
});

// 根路径
app.get('/', (req, res) => {
  res.json({
    message: '服务运行正常',
    endpoints: {
      wechat: '/api/wechat',
      deepseek: '/api/deepseek',
      health: '/health'
    }
  });
});

module.exports = app;